// pages/home/searchword/searchword.js
const app = getApp()
var base_url = app.globalData.url
Page({

  /**
   * 页面的初始数据
   */
  data: {
    vbg1: '#02C7A3',
    vbg2: '#ededed',
    vc1: 'white',
    vc2: '#999999',
    vis1: 'block',
    vis2: 'none'
  },
  video2: function () {
    var that = this
    that.setData({
      vbg1: '#ededed',
      vbg2: '#02C7A3',
      vc1: '#999999',
      vc2: '#ffffff',
      vis1: 'none',
      vis2: 'block'
      // videopath_hard: res["data"][0]['videopath_soft1']
    })
  },
  video1: function () {
    var that = this
    that.setData({
      vbg1: '#02C7A3',
      vbg2: '#ededed',
      vc1: 'white',
      vc2: '#02C7A3',
      // videopath_hard: res['data'][0]['videopath_hard'],
      vis1: 'block',
      vis2: 'none'
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    wx.getStorage({
      key: 'searchwordDatas',
      success: function (res) {
        console.log(res["data"])
        that.setData({
          wordDatas: res["data"],
          wordName: res["data"][0]["wordName"],
          pinyin: res["data"][0]["pinyin"],
          struct: res["data"][0]["struct"],
          rewording: res["data"][0]["rewording"],
          videopath_hard: res['data'][0]['videopath_hard'],
          videopath_soft1: res["data"][0]['videopath_soft1'],
          bishupath: res["data"][0]['bishupath'],
          wordPath: res["data"][0]['wordPath']
        })
        if (res['data'][0]['videopath_hard'] == '') {
          that.setData({
            showVideo: false
          })
        } else {
          that.setData({
            showVideo: true
          })
        }
        var otherWords = [];
        for (var i = 1; i < res["data"].length; i++) {
          otherWords.push(res["data"][i])
        }
        that.setData({
          otherWords: otherWords
        })
      },
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})